package ordinary;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Wukong
 * Date: 2022-06-03
 * Time: 14:23
 */
public class Genericity<T> {//表示当前的类是泛型类
    //T[]arr=new T[20];

    T[]arr=(T[])new Object[20];//1.
    public T getArr(int site) {
        return arr[site];
    }

    public void setArr(int site,T value) {
        this.arr[site] = value;
    }

    public static void main(String[] args) {
        Genericity<Integer> genericity=new Genericity<>();//2.
        genericity.setArr(0,20);
        int val=genericity.getArr(0);
        System.out.println(val);


    }


}
class Test{
    Object[] arry=new Object[20];

    public Object getArry(int site) {
        return arry[site];
    }

    public void setArry(int site,int value) {
        this.arry[site] = value;
    }

    public static void main(String[] args) {
        Test test=new Test();
        test.setArry(5,0);
        int val=(int)test.getArry(0);
        System.out.println(val);
    }
}
